package cn.xopencode.recordservice.dal.mysql.mapper.pdroom;

import cn.xopencode.recordservice.dal.mysql.dataobject.pdroom.PdRoomDeptRelDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface PdRoomDeptRelMapper extends BaseMapper<PdRoomDeptRelDO> {

    /**
     * 批量插入。因为 MyBaits Plus 的批量插入是基于 Service 实现，所以只好写 XML
     *
     * @param pdRoomDeptRels 数组
     */
    int insertList(@Param("pdRoomDeptRels") List<PdRoomDeptRelDO> pdRoomDeptRels);

    default List<PdRoomDeptRelDO> selectListByPdRoomId(String pdRoomId){
        return selectList(new QueryWrapper<PdRoomDeptRelDO>().eq("pdroom_id", pdRoomId));
    }

    default int deleteByPdroomId(String pdRoomId){
        return delete(new QueryWrapper<PdRoomDeptRelDO>().eq("pdroom_id", pdRoomId));
    }

}
